<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>地图导航</title>
    <style>
        * {
          margin: 0;
          padding: 0;
        }
        #container {
          width: 100%;
          height: 100vh;
        }
    </style>
    <script type="text/javascript">
          window._AMapSecurityConfig = {
              securityJsCode:'da2e250bb7af7a37e0989adac3b04295',
          }
    </script>
    <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=a727f22af65d64033da95ab95a10def8"></script>
</head>
<body>
  <div id="container"></div>
  <script>
    var map = new AMap.Map("container", {
       zoom: 15, //级别
       center: [116.397428, 39.90923], //中心点坐标
     })

     window.onload = async function () {
        if(window.shenling) {
          // 调用原生的getLocation方法，传递的方法名是hLocation
          shenling.getLocation("hLocation")
        }
     }
     function beginDriving(start, end) {
      AMap.plugin("AMap.Driving", function() {
        var driving = new AMap.Driving({
            // 驾车路线规划策略，AMap.DrivingPolicy.LEAST_TIME是最快捷模式
            policy: AMap.DrivingPolicy.LEAST_TIME,
            map,
          })
          var points = [{ keyword: start }, { keyword: end }]
          driving.search(points, function (status, result) {
            // 未出错时，result即是对应的路线规划方案
          })
      })
     }
   </script>
</body>
</html>